﻿ 

using System;

namespace CarTrackr.Business.Validation 
{
    public class FixedLengthRule: Rule
    {
        public override RuleType Type
        {
            get
            {
                return RuleType.FixedLength; 
            }
        }

        public override string  Text 
        {
            get
            {
                return PropertyName + " should be size of " + FixedLength+".";  
            }
        }

        public int FixedLength { get; set; }


        public override bool Validate(string value)
        {
           if (String.IsNullOrEmpty(value.Trim()))
            return false;

            return value.Length == FixedLength;

        }

    }
}
